/**
 * A TeslaCoil figure. extends Tower.
 * @authors Itay Sorani, Nadav Ziv, Yonathan Zarsky
 */
package com.example.models.Towers;

import com.example.models.*;
import com.example.models.Units.*;

import android.content.Context;

public class TeslaCoil extends Tower {
	
	private static final int TESLA_COIL_COST = 20;
	private static final int TESLA_COIL_RANGE = 6;
	private static final int TESLA_COIL_RATE = 2;
	private static final int TESLA_COIL_DAMAGE_AGAINST_PHONEIX = 20;
	private static final int TESLA_COIL_DAMAGE_AGAINST_DA_VINCI_TANK = 20;
	private static final int TESLA_COIL_DAMAGE_AGAINST_GOBLIN = 18;
	private static final int TESLA_COIL_DAMAGE_AGAINST_TROLL = 25;
	private static final String TESLA_COIL_NAME = "TeslaCoil";
	private static final float TESLA_COIL_SHOT_VELOCITY = 0.05f;
	private static final String TESLA_COIL_SHOT = "TeslaCoilShot";
	
	/**
     * Constructs a new TeslaCoil according to range, fire rate, name and cost.
     */
	public TeslaCoil(Context context) {
		super(context);
		setRange(TESLA_COIL_RANGE);
		setRate(TESLA_COIL_RATE * 40);
		setName(TESLA_COIL_NAME);
		setCost(TESLA_COIL_COST);
		setShotVelocity(TESLA_COIL_SHOT_VELOCITY);
		setShotName(TESLA_COIL_SHOT);
	}
	
	/**
     * returns the damage according to the given unit
     */
	public int getDamage(Unit unit) {
		if (unit instanceof Phoneix) {
			return (TESLA_COIL_DAMAGE_AGAINST_PHONEIX);
		}
		if (unit instanceof DaVinciTank) {
			return (TESLA_COIL_DAMAGE_AGAINST_DA_VINCI_TANK);
		}
		if (unit instanceof Goblin) {
			return (TESLA_COIL_DAMAGE_AGAINST_GOBLIN);
		}
		if (unit instanceof Troll) {
			return (TESLA_COIL_DAMAGE_AGAINST_TROLL);
		}
		return (0);
		
	}
}
